package main

import (
	"fileshare/conf"
	"fileshare/controller"
	"fileshare/sqlconn"
	"fileshare/utils"
	"log"
)

/**
* @program: fileshare
*
* @description:
*
* @author: Koco.Allien
*
* @create: 2020-04-05 15:58
**/
func main() {
	//配置文件
	conf.Run()
	//设置日志
	outputtype := conf.Cfg.Key("outputfile").MustBool(false)
	log.Println(outputtype)
	utils.SetLog(outputtype)

	//数据库
	sqlconn.Run()

	//打开路由
	router := controller.RouterRun()

	//开启服务
	httpport := ":" + conf.Cfg.Key("httpport").MustString("8080")
	if err := router.Run(httpport); err != nil {
		utils.ERRORToLog("开启程序失败", err)
	}
}
